//-----------------------------------------------------------------------
//  This file is part of the Microsoft Code Samples.
// 
//  Copyright (C) Microsoft Corporation.  All rights reserved.
// 
//  This source code is intended only as a supplement to Microsoft
//  Development Tools and/or on-line documentation.  See these other
//  materials for detailed information regarding Microsoft code samples.
// 
//  THIS CODE AND INFORMATION ARE PROVIDED AS IS WITHOUT WARRANTY OF ANY
//  KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
//  IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
//  PARTICULAR PURPOSE.
//-----------------------------------------------------------------------

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Globalization;

namespace Microsoft.Samples.SqlServer
{
	/// <summary>
	/// Summary description for Calendar.
	/// </summary>
	public class CalendarForm : System.Windows.Forms.Form
	{
		private bool isExitOK = false;

		private System.Windows.Forms.MonthCalendar monthCalendar1;

		private System.Windows.Forms.Button OKCalendarButton;

		private System.Windows.Forms.Button CancelCalendarButton;

		public bool IsExitOK
		{
			get
			{
				return isExitOK;
			}
		}

		public SelectionRange GetDateRange
		{
			get
			{
				return monthCalendar1.SelectionRange;
			}
		}

		/// <summary>
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.IContainer components = null;

		public CalendarForm()
		{
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();

			//
			// TODO: Add any constructor code after InitializeComponent call
			//
		}

		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if(components != null)
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CalendarForm));
            this.monthCalendar1 = new System.Windows.Forms.MonthCalendar();
            this.OKCalendarButton = new System.Windows.Forms.Button();
            this.CancelCalendarButton = new System.Windows.Forms.Button();
            this.SuspendLayout();
            // 
            // monthCalendar1
            // 
            resources.ApplyResources(this.monthCalendar1, "monthCalendar1");
            this.monthCalendar1.Name = "monthCalendar1";
            // 
            // OKCalendarButton
            // 
            this.OKCalendarButton.DialogResult = System.Windows.Forms.DialogResult.OK;
            resources.ApplyResources(this.OKCalendarButton, "OKCalendarButton");
            this.OKCalendarButton.Name = "OKCalendarButton";
            this.OKCalendarButton.Click += new System.EventHandler(this.OKCalendarButton_Click);
            // 
            // CancelCalendarButton
            // 
            this.CancelCalendarButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
            resources.ApplyResources(this.CancelCalendarButton, "CancelCalendarButton");
            this.CancelCalendarButton.Name = "CancelCalendarButton";
            this.CancelCalendarButton.Click += new System.EventHandler(this.CancelCalendarButton_Click);
            // 
            // CalendarForm
            // 
            this.AcceptButton = this.OKCalendarButton;
            resources.ApplyResources(this, "$this");
            this.CancelButton = this.CancelCalendarButton;
            this.ControlBox = false;
            this.Controls.Add(this.CancelCalendarButton);
            this.Controls.Add(this.OKCalendarButton);
            this.Controls.Add(this.monthCalendar1);
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
            this.MaximizeBox = false;
            this.MinimizeBox = false;
            this.Name = "CalendarForm";
            this.ResumeLayout(false);

		}
		#endregion

		private void OKCalendarButton_Click(object sender, System.EventArgs e)
		{
			((Button)sender).DialogResult = DialogResult.OK;
			this.Close();
		}

		private void CancelCalendarButton_Click(object sender, System.EventArgs e)
		{
			((Button)sender).DialogResult = DialogResult.Cancel;
			this.Close();
		}
	}
}
